package com.niuquan.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.niuquan.activitie.R;
import com.niuquan.modal.TaskItem;

import java.util.ArrayList;

/**
 * Created by DELL on 2015/5/24.
 */
public class HistoryAdapter extends BaseAdapter {
    private Context context;
    private ArrayList<TaskItem> m_items;
    private LayoutInflater inflater=null;
    public HistoryAdapter(Context context,ArrayList<TaskItem> items) {
        m_items = items;
        this.context = context;
    }

    @Override
    public int getCount() {
        return m_items.size();
    }

    @Override
    public TaskItem getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if(convertView == null){
            convertView = inflater.inflate(R.layout.history_layout_get, null);
        }
        TextView title = (TextView) convertView.findViewById(R.id.history_title);
        TextView deadline = (TextView) convertView.findViewById(R.id.historydeadline);
        TextView taskstate = (TextView) convertView.findViewById(R.id.historytaskstate);
        TextView niubi = (TextView) convertView.findViewById(R.id.historyniubi);
        TextView pingjia = (TextView) convertView.findViewById(R.id.historypingfen);
        title.setText(m_items.get(position).getM_title());
        deadline.setText(m_items.get(position).getM_deadline());
        taskstate.setText(m_items.get(position).getM_state());
        niubi.setText(m_items.get(position).getM_niubi());
        pingjia.setText(m_items.get(position).getM_comment());
        return convertView;
    }
}
